<%@ page language="java" contentType="text/html; charset=ISO-8859-1"
    pageEncoding="ISO-8859-1"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
<title>Login Page</title>
<link rel="stylesheet" type="text/css" href="CSS/ApplicationTheme.css"/>
<script language='javascript'>
function myFun()
{
	var trObj = document.getElementById("trAuthMsg");
	
	if(trObj.style.display  == 'block')
		trObj.style.display = 'none';
	else
		trObj.style.display = 'block';
	
}

function myFun2()
{
	var trObj = document.getElementById("trAuthMsg");
	trObj.style.display = 'none';
	//alert(window.event.keyCode);
}
function userWarningMessage()
{
	var userwarobj=document.getElementById("userwarning");
	if(userwarobj.style.display=='block')
		userwarobj.style.display='none';
	else
		userwarobj.style.display='block';
}
function passwordWarningMessage()
{
	var pwdwarobj=document.getElementById("pwdwarning");
	if(pwdwarobj.style.display=='block')
		pwdwarobj.style.display='none';
	else
		pwdwarobj.style.display='block';
}
function isEmpty()
{
		if((document.getElementById("user").value==0) && (document.getElementById("pwd").value==0))
		{
			//alert("Fields cannot be left blank");
			userWarningMessage();
			document.getElementById("user").focus();
			return false;
		}
		if(document.getElementById("user").value==0)
		{
			//alert("User Name cannot be left blank");
			userWarningMessage();
			document.getElementById("user").focus();
			return false;
		}
		if(document.getElementById("pwd").value==0)
		{
			//alert("Please enter Password");
			passwordWarningMessage();
			document.getElementById("pwd").focus();
			return false;
		}
		
		return true;	
}
</script>
</head>
<body>

  <table width=90% >
	
	<tr>
 	<%@include file="Menu.jsp" %>
 	</tr>
  
 </table>
 <form name=login method=post action=/PropertySite/checkCredential onsubmit="return isEmpty();">
 
 <table style="width:70%;">
		<tr>
 			<td style="width:100%">
				<table style="width:100%" cellpadding=0 cellspacing=0 border=0>
					<tr>
						<td class="top_left_corner"> </td>
						<td class="topline"> </td>
						<td class="top_right_corner"> </td>
					</tr>
						
					<tr>
						<td class="leftline"></td>
						<td class="workarea">
 							<center>
 							<table>
								<tr>  
							   		<td>UserName</td>
							   		<td><input type=text name=user id=user ></input></td>
							   		<td id="userwarning" style="display:none">
							   			<span style="color:red">User Name cannot be left blank</span>	
							   		</td>
								</tr>
								<tr>
							   		<td>Password</td>
							   		<td><input type=password name=pwd id=pwd></input></td>
							   		<td id="pwdwarning" style="display:none">
							   			<span style="color:red">Password cannot be left blank</span>	
							   		</td>
								</tr>
	
								<tr>
									<td><input type=submit value="submit"></input></td>
									<td><input type="reset" value="cancel" ></td>
								
								</tr>
								<tr id="trAuthMsg" style="display:none">
									<td colspan= 2>
										<span style="color:red"><%=request.getAttribute("authFailed")%>Authentication Failed.</span>
									</td>
								</tr>
							</table>
							</center>
						</td>
						<td class="rightline"></td>
					</tr>
							
					<tr>
						<td class="bottom_left_corner"></td>
						<td class="bottomline"></td>
						<td class="bottom_right_corner"></td>
					</tr>
				</table>
			</td>
		</tr>
	</table>			
	<p>Message:${message}</p>
	<c:remove var="message" scope="session" /c></c:remove>
	</form>   
</body>
<script language="javascript">
	
</script>
</html>